package com.lineage.server.serverpackets;

public class S_Paralysis extends ServerBasePacket {
  private byte[] _byte;
  
  public static final int TYPE_PARALYSIS = 1;
  
  public static final int TYPE_PARALYSIS2 = 2;
  
  public static final int TYPE_SLEEP = 3;
  
  public static final int TYPE_FREEZE = 4;
  
  public static final int TYPE_STUN = 5;
  
  public static final int TYPE_BIND = 6;
  
  public static final int TYPE_TELEPORT_UNLOCK = 7;
  
  public static final int TYPE_POWERGRIP = 26;
  
  public static final int TYPE_DESPERADO = 30;
  
  public S_Paralysis(int type, boolean flag) {
    this._byte = null;
    writeC(202);
    switch (type) {
      case 1:
        if (flag) {
          writeC(2);
          break;
        } 
        writeC(3);
        break;
      case 2:
        if (flag) {
          writeC(4);
          break;
        } 
        writeC(5);
        break;
      case 7:
        if (flag) {
          writeC(6);
          break;
        } 
        writeC(7);
        break;
      case 3:
        if (flag) {
          writeC(10);
          break;
        } 
        writeC(11);
        break;
      case 4:
        if (flag) {
          writeC(12);
          break;
        } 
        writeC(13);
        break;
      case 5:
        if (flag) {
          writeC(22);
          break;
        } 
        writeC(23);
        break;
      case 6:
        if (flag) {
          writeC(24);
          break;
        } 
        writeC(25);
        break;
      case 26:
        if (flag) {
          writeC(26);
          break;
        } 
        writeC(27);
        break;
      case 30:
        if (flag) {
          writeC(30);
          break;
        } 
        writeC(31);
        break;
    } 
  }
  
  public S_Paralysis(int type, boolean flag, int time) {
    this._byte = null;
    writeC(202);
    if (type == 1) {
      if (flag) {
        writeC(2);
        writeH(0);
        writeH(time);
      } else {
        writeC(3);
        writeH(0);
        writeH(0);
      } 
    } else if (type == 2) {
      if (flag) {
        writeC(4);
        writeH(0);
        writeH(time);
      } else {
        writeC(5);
        writeH(0);
        writeH(0);
      } 
    } else if (type == 7) {
      writeC(7);
      writeH(0);
      writeH(0);
    } else if (type == 3) {
      if (flag) {
        writeC(10);
        writeH(0);
        writeH(0);
      } else {
        writeC(11);
        writeH(0);
        writeH(0);
      } 
    } else if (type == 4) {
      if (flag) {
        writeC(12);
        writeH(0);
        writeH(0);
      } else {
        writeC(13);
        writeH(0);
        writeH(0);
      } 
    } else if (type == 5) {
      if (flag) {
        writeC(22);
        writeH(0);
        writeH(0);
      } else {
        writeC(23);
        writeH(0);
        writeH(0);
      } 
    } else if (type == 6) {
      if (flag) {
        writeC(24);
        writeH(0);
        writeH(0);
      } else {
        writeC(25);
        writeH(0);
        writeH(0);
      } 
    } 
  }
  
  public byte[] getContent() {
    if (this._byte == null)
      this._byte = getBytes(); 
    return this._byte;
  }
  
  public String getType() {
    return getClass().getSimpleName();
  }
}
